#include<iostream>
#include<algorithm>

using namespace std;

const int N = 3e4 + 10;
int w , n;
int a[N];

int main()
{
    cin >> w >> n;
    for(int i = 1;i <= n;i ++) cin >> a[i];
    sort(a + 1 , a + 1 + n);
    int ret = 0;
    int l = 1 , r = n;
    while(l <= r)
    {
        if(a[l] + a[r] <= w) l++ , r--;
        else r --;
        ret ++;
    }
    cout << ret << endl;
    return 0;
}